{include file="inc/header.html"}
<script type="text/javascript" src="{$TMPL}/js/jscharts_cr.js"></script>
<adv adv_id="我要理财列表页顶部广告" />
	<p class="pos"><a href="{url x="index" r="index"}">首页</a> > <a href="{url x="index" r="transfer"}">投资列表</a></p>
	<div id="content" class="clearfix">
		<div class="short filterbox">
			<div class="bddf clearfix" id="deallist" name="deallist">
				<div class="filter clearfix">
		            <div class="f_l f_dgray b">筛选条件</div>
		        </div>
				<div class="propAttrs clearfix pr {if $scity_id neq 0 || $deal_status neq 0 || $level neq 0 || $interest neq 0 || $lefttime neq 0}v{/if}" id="search_condition" {if $scity_id eq 0 && $deal_status eq 0 && $level eq 0 && $interest eq 0 && $lefttime eq 0}style="height:130px"{/if}>
					<a href="javascript:void(0);" class="j_more  ps" style="bottom:10px;right:10px;z-index:10;color:#01bcef">更多筛选<img src="{$TMPL}/images/more_down.png" /></a>
		            <form action="{url x="index" r="deals" p="cid=$cid"}" method="post" id="searchByConditionForm">
		                
						{if $cate_list_url}
						<div class="attr">
		                    <div class="attrKey">认证标识：</div>
		                    <div class="attrValues">
								<ul class="av-collapse" id="dashboard">
									{foreach from =$cate_list_url item="cates" key=key}
									<li >
										<a href="{$cates.url}#deallist" {if $cates.id eq $cate_id}class="cur"{/if}>{$cates.name}</a>
									</li>
									{/foreach}								
								</ul>
		                    </div>
		                </div>
						{/if}
						{if $city_urls}
						 <div class="attr">
							<div class="attrKey">区域列表：</div>
							<div class="attrValues">
								<ul class="av-collapse" name="city" id="city">
									{foreach from="$city_urls" item="city" key=key}
		                            <li><a href="{$city.url}#deallist"  {if $city.id eq $city_id} class="cur" {/if}>{$city.name}</a></li>
									{/foreach}
		                        </ul>
		                    </div>
		                </div>
						{/if}
						{if $sub_citys}
						<div class="attr">
							<div class="attrKey">城市列表：</div>
							<div class="attrValues">
								<ul class="av-collapse" name="city" id="city">
									{foreach from="$sub_citys" item="scity" key=key}
		                            <li><a href="{$scity.url}#deallist"  {if $scity.id eq $scity_id} class="cur" {/if}>{$scity.name}</a></li>
									{/foreach}
		                        </ul>
		                    </div>
		                </div>
						{/if}
						
						
						<div class="attr">
							<div class="attrKey">借款期限：</div>
							<div class="attrValues">
								<ul class="av-collapse" name="interest" id="months">
									{foreach from="$months_type_url" item="months" key=key}
		                            <li><a href="{$months.url}#deallist" {if $key eq $months_type}class="cur"{/if}>{$months.name}</a></li>
									{/foreach}
		                        </ul>
		                    </div>
		                </div>
						<div class="attr">
		                    <div class="attrKey">借款状态：</div>
							
		                    <div class="attrValues">
								<ul class="av-collapse" id="dashboard">
									{foreach from =$deal_status_url item="status" key=key}
									<li >
										<a href="{$status.url}#deallist" {if $key eq $deal_status}class="cur"{/if}>{$status.name}</a>
									</li>
									{/foreach}
																				
								</ul>
		                    </div>
		                </div>
						
						<div class="attr">
		                    <div class="attrKey">信誉等级：</div>
		                    <div class="attrValues">
								<ul class="av-collapse" name="level" id="level">
									{foreach from =$level_list_url item="ilevel" key=key}
								   <li>
									   <a href="{$ilevel.url}#deallist" {if $level eq $ilevel.id}class="cur"{/if}>{$ilevel.name}{if $key neq 0}以上{/if}</a>
								   </li>
								   {/foreach}
								</ul>
							</div>
		                </div>
						<div class="attr">
		                    <div class="attrKey">回馈利率：</div>
		                    <div class="attrValues">
								<ul class="av-collapse" name="interest" id="interest">
		                           {foreach from =$interest_url item="iinterest" key=key}
								   <li>
									   <a href="{$iinterest.url}#deallist" {if $interest eq $iinterest.interest}class="cur"{/if}>{$iinterest.name}{if $key neq 0}以上{/if}</a>
								   </li>
								   {/foreach}
		                        </ul>
		                    </div>
		                </div>
						
						<div class="attr">
		                    <div class="attrKey">剩余时间：</div>
		                    <div class="attrValues">
								<ul class="av-collapse" name="lefttime" id="lefttime">
		                            {foreach from =$lefttime_url item="ilefttime" key=key}
								   <li>
									   <a href="{$ilefttime.url}#deallist" {if $lefttime eq $ilefttime.lefttime}class="cur"{/if}>{$ilefttime.name}{if $key neq 0}以内{/if}</a>
								   </li>
								   {/foreach}
		                        </ul>
		                    </div>
		                </div>
		                
		               
		                
		            </form>
		        </div>
			</div>
			<div class="blank"></div>
			<div class="blank"></div>
		</div>
		<div class="list">
			<div class="list_title clearfix">
				<div class="list1 cur" >投资列表</div>
				<div class="list2" onclick="window.location.href='{url x="index" r="transfer"}'">债权转让</div>
				<a href="{url x="index" r="tool"}" class="calt">理财计算器</a>
			</div>
			<div class="list_cont">
            	<div class="i_deal_list">
                    {foreach from=$deal_list item="deal" key=key name="deal"}
                    <ul class="clearfix">
                        <li class="i_deal_list_left"><img src="{$deal.icon}" width="80" height="80"/></li>
                        <li class="i_deal_list_title">
                            <div class="idl_title"><a href="{$deal.url}" target="_blank" title="{$deal.name}">{$deal.sub_name}</a></div>
                            <div>年化收益：{$deal.rate} %</div>
                            <div>信用等级：<img src="{$TMPL}/images/{$deal.user.point_level}.png" align="absmiddle" title="{$deal.user.point_level}" alt="{$deal.user.point_level}" height="40" /></div>
                        </li>
                        <li class="i_deal_list_mid">
                            <div>
                                <div class=" mitem">
                                    <div>
                                        <img src="{$deal.cate_info.icon}"  height="25" class="ico" title="{$deal.cate_info.name}" />
                                        {if $deal.user_bid_rebate > 0}
                                        <span class="reward"><label>奖</label> {$deal.user_bid_rebate}%</span>
                                        {/if}
                                        
                                    </div>
                                    <div>借款金额：<span class="m_money">¥{$deal.borrow_amount}</span></div>
                                    <div>还款方式：<span class="gray">{if $deal.loantype==0}等额本息{elseif $deal.loantype==1}付息还本{elseif $deal.loantype==2}到期还本息{/if}</span></div>
                                </div>
                                <div class=" mitem">
                                    <div>发布时间：{$deal.publish_time_format}</div>
                                    <div>借款期限	：{$deal.repay_time}{if $deal.repay_time_type eq 0}天{else}个月{/if}</div>
                                    <div>剩余时间：<span class="gray">{$deal.remain_time_format}</span></div>
                                </div>
                            </div>
                        </li>
                        <li class="i_deal_list_right">
                            <div class="idlr_remain">剩余金额：<span class="m_money">{if $deal.uloadtype eq 0}{$deal.need_money}{else}{$deal.need_portion}{/if}</span><span class="idlr_sm"> 已投<span class="m_money">{$deal.buy_count}</span>笔</span></div>
                			<div class="idlr_bar">
                                <div class="blueProgressBar progressBar f_l">
                                    <div class="p">
                                    {if  $deal.deal_status eq 5}
                                        <div class="c" style="width: 100%;background:url('{$TMPL}/images/progressBarBg.png') repeat-x"></div>
                                    {elseif $deal.deal_status eq 4}
                                        <div class="c" style="width: {function name='round' val=$deal.repay_progress_point f=3}%;background:url('{$TMPL}/images/progressBarBg.png') repeat-x"></div>
                                    {else}
                                        <div class="c" style="width: {function name='round' val=$deal.progress_point f=3}%;background:url('{$TMPL}/images/progressBarBg.png') repeat-x"></div>
                                    {/if}
                                    </div>
                                </div>
                                <div class="m_rate f_l">
                                    {if  $deal.deal_status eq 5}
                                        100%
                                    {elseif $deal.deal_status eq 4}
                                        {function name='round' v='$deal.repay_progress_point' f=0}%
                                    {else}
                                        {function name="round" v=$deal.progress_point f=0}%
                                    {/if}
                                </div>
                            </div>
                            <div class="clear">
                                <a href="{$deal.url}" target="_blank">
                                    {if $deal.is_delete eq 2}
                                        <span class="f_white">待发布</span>
                                    {elseif $deal.is_wait eq 1}
                                        <span class="f_white">未开始</span>
                                    {elseif $deal.deal_status eq 5}
                                        <span class="f_white f_green">还款完毕</span>
                                    {elseif $deal.deal_status eq 4}
                                        <span class="f_white f_green">还款中</span>
                                    {elseif $deal.deal_status eq 0}
                                        <span class="f_white">等待材料</span>
                                    {elseif $deal.deal_status eq 1 && $deal.remain_time gt 0}
                                        <span class="f_white">立即投资</span>
                                    {elseif $deal.deal_status eq 2}
                                        <span class="f_white f_orange">满标</span>
                                    {elseif $deal.deal_status eq 3 || $deal.remain_time lte 0}
                                        <span class="f_white f_gray">流标</span>
                                    {/if}
                                </a>
                            </div>
                        </li>
                    </ul>
                   {/foreach}
                </div>
				<div class="pages">{$pages}</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	
	jQuery(function(){
		$("#case").find("li:odd").css("backgroundColor","#f9f9f9");

		var p_width=$(".i_deal_list p").width();
	   	var box_width=$(".i_deal_list .graph-box").width();
	   	var left_w=(box_width/2)-(p_width/2);
	   	$(".i_deal_list p").css("left",left_w+"px");

		$("#searchByKeyForm .searchinput").bind("focus",function(){
			if($.trim($(this).val())=="请输入您的搜索条件"){
				$(this).val("");
				$(this).removeClass("f_dgray");
			}
		});
		$("#searchByKeyForm .searchinput").bind("blur",function(){
			if($.trim($(this).val())=="请输入您的搜索条件" || $.trim($(this).val())==""){
				$(this).val("请输入您的搜索条件");
				$(this).addClass("f_dgray");
			}
		});
		
		$("#search_condition .j_more").click(function(){
			if(!$("#search_condition").hasClass("v")){
				$("#search_condition").css({"height":"270px"});
				$("#search_condition").addClass("v");
			}
			else{
				$("#search_condition").css({"height":"130px"});
				$("#search_condition").removeClass("v");
			}
		});
	});
	function searchByCondition(){
		$("#searchByConditionForm").submit();
	}
	function searchLoans(){
		if($.trim($("#searchByKeyForm .searchinput").val())=="请输入您的搜索条件" || $.trim($("#searchByKeyForm .searchinput").val())==""){
			$.showErr("请输入您的搜索条件");
			return false;
		}
		$("#searchByKeyForm").submit();
	};
	
	function calculate(){
		var amount=$("#calculateAmount").val();
        var interest=$("#calculateInterest").val();
        var month=$("#calculateMonth").val();
		var repayType = $("#repayType").val();

        if((amount.replace(/[ ]/g, "")) == "" || (amount.replace(/[ ]/g, "")) == null||amount==""||amount==null){
            $.showErr("请输入初始投资");
            return;
        }else{
            amount=$.trim(amount);
            if(/^(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/.test(amount)==false){
                $.showErr("初始投资只能为整数或者小数且最多只能有两位小数");
                return;
            }else{
                if(amount>1000000){
                    $.showErr("初始投资为100万以下");
                    return;
                }
            }
        }
        if((interest.replace(/[ ]/g, "")) == "" || (interest.replace(/[ ]/g, "")) == null||interest==""||interest==null){
            $.showErr("请输入年利率");
            return;
        }else{
            interest=$.trim(interest);
            if(/^(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/.test(interest)==false){
                $.showErr("年利率只能为整数或者小数且最多只能有两位小数");
                return;
            }else{
                if(interest>=100){
                    $.showErr("年利率必须在100%以下");
                    return false;
                }
            }
        }
        if((month.replace(/[ ]/g, "")) == "" || (month.replace(/[ ]/g, "")) == null||month==""||month==null){
            $.showErr("请输入投资期限");
            return;
        }else{
            month=$.trim(month);
            if(/^(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/.test(month)==false){
                $.showErr("投资期限只能为整数或者小数且最多只能有两位小数");
                return;
            }else{
                if(month>100){
                    $.showErr("投资期限为100月以内");
                    return;
                }
            }
        }
        var value = 0;
	    var inters= interest /(100*12);
		if(repayType==0){
			value= month*amount*(inters*Math.pow((1+inters), month) / (Math.pow((1+inters),month)-1));
		}
		else if(repayType==1){
			value = parseFloat(amount) + parseFloat(inters*amount*month);
		}
		else if(repayType==2){
			value = parseFloat(amount) + parseFloat(inters*amount*month);
		}
		
        $("#lastValue").html(formatNum(value));
    }
</script>
{include file="inc/footer.html"}